﻿@model ASPMVC_first_app.ViewModels.CustomerFormViewModel
@{
    ViewBag.Title = "Customer";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Customer</h2>

@using (Html.BeginForm("Save", "User"))
{

    @Html.ValidationSummary(true, "Please enter information to red fields");
    <div class="form-group">
        @Html.LabelFor(m => m.Customer.FirstName)
        @Html.TextBoxFor(m => m.Customer.FirstName, new {@class= "form-control" })
        @Html.ValidationMessageFor(m => m.Customer.FirstName)
    </div>

    <div class="form-group">
        @Html.LabelFor(m => m.Customer.LastName)
        @Html.TextBoxFor(m => m.Customer.LastName, new { @class = "form-control" })
        @Html.ValidationMessageFor(m => m.Customer.LastName)
    </div>
    <div class="form-group">
        @Html.LabelFor(m => m.Customer.MembershipTypeId)
        @Html.DropDownListFor(m => m.Customer.MembershipTypeId,
       new SelectList(Model.MembershipTypes, "Id", "Name"),
       "Select MemberShip",
       new { @class="form-control"})
        @Html.ValidationMessageFor(m => m.Customer.MembershipTypeId)
    </div>
    <div class="checkbox">
        <label>
            @Html.CheckBoxFor(m => m.Customer.IsSubscribed) Subscribe for news?            
        </label>
    </div>
    <div class="form-group">
        @Html.LabelFor(m => m.Customer.DateOfBirth)
        @Html.TextBoxFor(m => m.Customer.DateOfBirth,"{0:d, MMM yyyy}", new { @class = "form-control" })
        @Html.ValidationMessageFor(m => m.Customer.DateOfBirth)
    </div>
    @Html.HiddenFor(m => m.Customer.Id);
    @Html.AntiForgeryToken();
    <div>
        <button type = "submit" class="btn btn-primary">Save</button>
    </div>
}

@section scripts
{
    @Scripts.Render("~/bundles/jqueryval")
}
